<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div desc="houdunren">在线学习</div>
    <div desc="hdcms">开源产品</div>
    <script>
        let divs = document.querySelectorAll("div")
        divs.forEach(function(item) {
            let desc = item.getAttribute('desc')
            item.addEventListener("click", function() {
                // console.log(item.getAttribute('desc'));
                console.log(desc);
                console.log(item);
            })
            item = null
        })
    </script>
</body>

</html>